<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绑定函数练习</title>
</head>
<body>
    <script>
        //  function foo()
        //  {
        //     console.log("this的指向:",this);
        //  }

        //  //默认情况下一般都是window对象
        //  foo();
        //  //使用call绑定this,绑定的就是字符串对象，String
        //  foo.call("abc");

         function foo2(name,home)
         {
            console.log("this指向：",this);
            console.log(name,home);
         }

         foo2.call("abc","cq","上海市");
         foo2.call("cbd",["niu","北京市"]);
         foo2.apply("abc",["cq","上海市"]);

        var bindCall = foo2.bind("aaa","cq","广州市");
        bindCall();

    </script>
</body>
</html>